package y24.m5.file;
import java.util.List;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        StudentSystem student = new StudentSystem();
        while (true){
            student.menu1();
            Scanner scanner = new Scanner(System.in);
            int i =  scanner.nextInt();
            List<Student> students;
            switch (i){
                case 1:
                    if (student.readStudentFile()){
                        System.out.println("请输入id,学生姓名,成绩<以#号结束>");
                        students = student.creatStudenArray();
                        student.inputStudent(students);
                    }else {
                        student.menu2();
                        i = scanner.nextInt();
                        switch (i){
                            case 1:
                                System.out.println("请输入id,学生姓名,成绩<以#号结束>");
                                students = student.creatStudenArray();
                                student.inputStudent(students);
                                break;
                            case 2:
                                System.out.println("请输入id,学生姓名,成绩<以#号结束>");
                                students = student.creatStudenArray();
                                student.addStudent(students);
                                break;
                            case 3:
                                break;
                            default:
                                System.out.println("输入错误，请重新输入");
                                break;
                        }
                    }
                    break;
                case 2:
                    System.exit(0);
                    break;
                default:
                    System.out.println("输入错误，请重新输入");
                    break;
            }
        }
    }
}